// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IServerConnectionService.cs" company="Scrum for Team System">
//   None
// </copyright>
// <summary>
//   Defines the IServerConnectionService type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace ScrumForTeamSystem.EventService.Infrastructure.Interfaces
{
    using System;

    using ScrumForTeamSystem.EventService.Infrastructure;
    using ScrumForTeamSystem.EventService.Infrastructure.Enums;

    /// <summary>
    /// Defines the server connection service interface
    /// </summary>
    public interface IServerConnectionService : IMessageProducer
    {
        /// <summary>
        /// Occurs when [connected state set] event raised.
        /// </summary>
        event EventHandler<ConnectionStateChangedEventArgs> ConnectedStateSet;

        /// <summary>
        /// Sets the state of the connection.
        /// </summary>
        /// <param name="connectionState">State of the connection.</param>
        void SetConnectionState(ConnectionState connectionState);

        /// <summary>
        /// Gets the server URL.
        /// </summary>
        /// <param name="useSecureSocketLayer">The use of ssl.</param>
        /// <param name="server">The server.</param>
        /// <param name="port">The port number.</param>
        /// <returns>The server uri as a string</returns>
        string GetServerAddress(bool useSecureSocketLayer, string server, int port);

        /// <summary>
        /// Gets the TFS service provider.
        /// </summary>
        /// <param name="connectionString">The connection string.</param>
        /// <returns>The team foundation server instance</returns>
        IServiceProvider GetTfsServiceProvider(string connectionString);

        /// <summary>
        /// Determines whether [the specified host] [is valid connection details].
        /// </summary>
        /// <param name="host">The host name.</param>
        /// <param name="port">The port number.</param>
        /// <returns>
        /// <c>true</c> if [the specified host] [is valid connection details]; otherwise, <c>false</c>.
        /// </returns>
        bool IsValidConnectionDetails(string host, int port);
    }
}